const bounds = [120.3, 30.2648, 121.297, 31.037]; // 以上为 wangzeyang百度坐标查询手动数据 以限制矢量瓦片的搜寻范围 （超出范围会400错误）

const autoGeoServer =
  process.env.NODE_ENV === 'production' ? 'http://8.136.236.190:30000/geoserver' : 'http://10.0.13.90:8085/geoserver';
export function getGeoServer ({ geoServer = autoGeoServer, layer, format = 'application/vnd.mapbox-vector-tile', elseStr = '' }) {
  return `${geoServer}/gwc/service/wmts?style=&tilematrixset=EPSG:900913&Service=WMTS&Request=GetTile&Version=1.0.0&TileMatrix=EPSG:900913:{z}&TileCol={x}&TileRow={y}&layer=${layer}&transparent=true&format=${format}${elseStr}`;
}

// 第三方服务
const otherSerUrl = 'http://60.191.1.10:8080/geoserver';
function getThirdPartyServeUrl ({ layers }) {
  return `${otherSerUrl}/iZw6ntwpqmgcqeZ/wms?service=WMS&version=1.1.0&request=GetMap&width=256&height=256&srs=EPSG:3857&bbox={bbox-epsg-3857}&layers=${layers}&transparent=true&format=image/png`;
}
export const sourceMap = {
  // 农资店 点数据
  famerStore: {
    tiles: [getGeoServer({ layer: 'zhejiang:tb_operating_shop' })],
    type: 'vector'
  },
  //  规模大户 面数据
  // zhejiang:tb_cereal 900913 种植管理 规模大户一张图
  //  wms服务要带上这个CQL_FILTER=farmer_type%20like%20%27%E8%A7%84%E6%A8%A1%E7%A7%8D%E7%B2%AE%E5%A4%A7%E6%88%B7%25%27  查询条件,面数据

  largeScaleFarmers: {
    tiles: [getGeoServer({ geoServer: 'http://8.136.236.190:30000/geoserver', layer: 'zhejiang:tb_cereal_veiw' })],
    type: 'vector'
  },
  wheat: {
    // bounds,
    tiles: [getGeoServer({ geoServer: 'http://8.136.236.190:30000/geoserver', layer: 'zhejiang:tb_wheat' })],
    type: 'vector'
  },
  JXLSGNQ: {
    // bounds,
    tiles: [getGeoServer({ layer: 'cockpit:JXLSGNQ' })],
    type: 'vector'
  },
  //  补贴类型 区统计值
  street: {
    tiles: [getGeoServer({ layer: 'cockpit:xz_84' })],
    type: 'vector'
  },
  // 补贴-金额-街镇
  streetPoints: {
    tiles: [getGeoServer({ geoServer: 'http://8.136.236.190:30000/geoserver', layer: 'cockpit:xz_84_points' })],
    type: 'vector'
  },
  // 补贴-金额-区县
  districtPoints: {
    tiles: [getGeoServer({ geoServer: 'http://8.136.236.190:30000/geoserver', layer: 'cockpit:qx_84_points' })],
    type: 'vector'
  },
  // 生产布局-水稻
  paddy: {
    // bounds,
    tiles: [getGeoServer({ layer: 'cockpit:paddy' })],
    type: 'vector'
  },
  // paddy: {
  //   type: "geojson",
  //   data: "/static/gis/data/paddy.json",
  //   generateId: true
  // },
  // 杂粮产量
  cropsOutput: {
    type: 'geojson',
    data: '/static/gis/data/cropsOutput.json',
    generateId: true
  },

  // 补贴-杂粮
  cereal: {
    tiles: [getGeoServer({ layer: 'cockpit:cereal' })],
    type: 'vector'
  },
  TR330400_25: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'TR330400_25' })],
    tileSize: 256
  },
  LUS3304002018_ZLDJ: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_ZLDJ' })],
    tileSize: 256
  },
  LUS3304002018_AP: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_AP' })],
    tileSize: 256
  },
  LUS3304002018_AK: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_AK' })],
    tileSize: 256
  },
  LUS3304002018_OM: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_OM' })],
    tileSize: 256
  },
  LUS3304002018_PH: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_PH' })],
    tileSize: 256
  },
  LUS3304002018_TN: {
    type: 'raster',
    tiles: [getThirdPartyServeUrl({ layers: 'LUS3304002018_TN' })],
    tileSize: 256
  },
  IoT: {
    type: 'geojson',
    data: null
  },
  Bugs: {
    type: 'geojson',
    data: null
  },
  paymentSource: {
    type: 'geojson',
    data: null
  },
  // 生产任务一张图 （包涵各个农作物的信息）
  productsTask: {
    type: 'geojson',
    data: null
  }
};